﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;

namespace XMK.Framework.Model.Sp
{
    /// <summary>
    /// Ajax方法交互的映射集合类，用户配置方法别名和实际方面名已经参数类型列表的映射
    /// </summary>
    [XmlRoot("SpMapping")]
    public class SpMappingInfo
    {
        /// <summary>
        /// 需要引用的命名空间
        /// </summary>
        [XmlAttribute("Assemblies")]
        public string Assemblies { get; set; }
        /// <summary>
        /// 需调用存储过程的方法交互的映射类列表
        /// </summary>
        [XmlElement(ElementName = "DataMapping")]
        public List<DataMappingInfo> DataMappings { get; set; }
    }
    /// <summary>
    /// Ajax方法交互的映射类
    /// </summary>
    [Serializable]
    public class DataMappingInfo
    {
        /// <summary>
        /// 类名
        /// </summary>
        [XmlAttribute("Name")]
        public string Name { get; set; }
        /// <summary>
        /// 数据库连接字符串
        /// </summary>
        [XmlAttribute("DbConn")]
        public string DbConn { get; set; }
        /// <summary>
        /// AjaxMethodMappingInfo集合
        /// </summary>
        [XmlElement(ElementName = "MethodMapping")]
        public List<MethodMappingInfo> MethodMappings { get; set; }
    }
    /// <summary>
    /// Ajax方法交互的映射类，用户配置方法别名和实际方面名已经参数类型列表的映射
    /// </summary>
    [Serializable]
    public class MethodMappingInfo
    {
        /// <summary>
        /// 接口编号
        /// </summary>
        [XmlAttribute("SpName")]
        public string SpName { get; set; }
        /// <summary>
        /// 方法全名
        /// 规则：XMK.Xxxx.XxxxBusiness.xxxMthod，其中xxxMthod是真实的方法名，XxxxBusiness是方法所在的类名，XMK.Xxxx为方法所在的类的命名空间
        /// </summary>
        [XmlAttribute("MethodName")]
        public string MethodName { get; set; }
        /// <summary>
        /// 方法的参数类型
        /// </summary>
        [XmlAttribute("ParaTypes")]
        public string ParaTypes { get; set; }
        /// <summary>
        /// 方法的返回类型
        /// </summary>
        [XmlAttribute("ReturnType")]
        public string ReturnType { get; set; }
    }
}